using Items;
using System;
using System.Collections.Generic;

[Serializable]
public class SaveData_Container : SaveData
{
    public List<SaveData_ItemStack> itemDatas;

    public SaveData_Container()
    {
        itemDatas = new List<SaveData_ItemStack>();
    }

    public override void Save(ISavable obj)
    {
        base.Save(obj);
        itemDatas.Clear();
        Container container = obj as Container;
        SaveData_ItemStack data;
        foreach (ItemStack stack in container.GetAllItem())
        {
            data = new SaveData_ItemStack();
            data.Save(stack);
            itemDatas.Add(data);
        }
    }
}

[Serializable]
public class SaveData_ItemStack : SaveData
{
    public int count;

    public override void Save(ISavable obj)
    {
        base.Save(obj);
        ItemStack stack = obj as ItemStack;
        count = stack.Count;
    }
}